package com.heima.wemedia.config;


import com.heima.wemedia.interceptor.WmTokenInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//配置类使拦截器生效 需要实现WebMvcConfigurer接口重写addInterceptors
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    //配置使用拦截器生效,拦截所有请求 调注册方法添加对应打拦截器然后添加向拦截的路径
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new WmTokenInterceptor()).addPathPatterns("/**");
    }


}
